﻿@model EasySite.Web.ViewModels.Page.EditViewModel

<div id="pageEditPage" class="page">
    @Html.RoundPanel("Page editor", @<text>
        <form id="pageEditForm" action="">
            <input id="hfPageID" type="hidden" value="@Model.Page.ID" name="Page.ID" />
            <table>
                <colgroup>
                    <col width="120px" />
                    <col width="auto" />
                </colgroup>
                <tbody>
                    <tr>
                        <td>Category: </td>
                        <td>
                            @Html.Partial("PageCategorySelector")
                        </td>
                    </tr>
                    <tr>
                        <td>Url:</td>
                        <td>
                            @Html.TextBoxFor(m => m.Page.Url, new { @class = "txt" })
                        </td>
                    </tr>
                    <tr>
                        <td>Layout:</td>
                        <td>
                            <input type="text" value="@(string.IsNullOrEmpty(Model.Page.LayoutSrc)?"~/Views/Shared/_Layout.cshtml":Model.Page.LayoutSrc)"
                             name="Page.LayoutSrc" class="txt" />
                        </td>
                    </tr>
                    <tr>
                        <td>Title:</td>
                        <td>
                            @Html.TextBoxFor(m => m.Page.Title, new { @class = "txt" })
                        </td>
                    </tr>
                    <tr>
                        <td>Keywords:</td>
                        <td>
                            @Html.TextAreaFor(m => m.Page.Keywords, new { @class = "txt" })
                        </td>
                    </tr>
                    <tr>
                        <td>Description:</td>
                        <td>
                            @Html.TextAreaFor(m => m.Page.Description, new { @class = "txt" })
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input id="rdoUseView" type="radio" name="Page.UseView" value="true" @(Model.Page.UseView?"checked='checked'":"") />
                            <label for="rdoUseView">Use view</label>
                            <input id="rdoUseContent" type="radio" name="Page.UseView" value="true"  @(Model.Page.UseView?"":"checked='checked'") />
                            <label for="rdoUseContent">Use content</label>
                        </td>
                    </tr>
                    <tr id="rowView" class="@(Model.Page.UseView?"":"hide")">
                        <td>View src:</td>
                        <td>
                            @Html.TextBoxFor(m => m.Page.ViewSrc, new { @class = "txt" })
                        </td>
                    </tr>
                    <tr id="rowContent" class="@(Model.Page.UseView?"hide":"")">
                        <td>Content:</td>
                        <td>
                            @Html.TextAreaFor(m => m.Page.Content, new { @class = "txt" })
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>
                            <input id="btnSave" type="button" class="button-s" value="Save" />
                            <input id="btnBack" type="button" class="button-s" value="Go Back" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </text>, new { @class = "gray" })
</div>
<script src="/Scripts/EasySite/PageEditor.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    var editor = null;
    $(document).ready(function () {
        editor = new PageEditor();
        editor.Init();
    });
</script>
